package com.sq.partner.manager.service;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.sq.partner.manager.mybatis.model.CoreProdInst;
import com.sq.partner.manager.mybatis.model.CoreProdPlan;
import com.sq.partner.manager.mybatis.model.RiskAlgMap;
import com.sq.partner.manager.mybatis.model.TradCalDef;
import com.sq.partner.manager.mybatis.model.TradInsuPlan;
import com.sq.partner.manager.mybatis.model.TradItemCal;
import com.sq.partner.manager.mybatis.model.TradPlanBase;
import com.sq.partner.manager.mybatis.model.TradPlanCov;
import com.sq.partner.manager.mybatis.model.TradProdInst;
import com.sq.partner.manager.mybatis.model.TradProdPlan;
import com.sq.partner.manager.util.Page;

public interface IGatewayProductService  extends BaseService<TradProdInst, String> {

	/**
	 * 查找实体对象分页
	 * 
	 * @param pageable
	 *            分页信息
	 * @return 实体对象分页
	 */
	public Page<TradProdInst> queryPage(Page<TradProdInst> page) throws SQLException ;
	
	public Page<CoreProdInst> queryProdInstPage(Page<CoreProdInst> page) throws SQLException;

	public TradProdInst saveTradProdInst(TradProdInst tradProdInst) throws Exception;

	public void deleteTradProdInst(TradProdInst tradProdInst) throws Exception;

	public Page<CoreProdPlan> queryProdPlan(String tradProdCode)throws SQLException;

	public TradProdInst queryTradProdInstById(String tradProdCode)throws SQLException;

	public Page<CoreProdPlan> queryProdPlan(Page<CoreProdPlan> page,TradProdInst tradProdInst)throws SQLException;

	public List<TradCalDef> queryTradCalDef(TradCalDef trad)throws SQLException ;

	public void savePlan(CoreProdPlan choosePlan,String tradProdCode, String prodInstCode,
			String insType, String planCode, String instCode, String insnme,
			String tradPlanDesc, BigDecimal amount, String required, String calDefId,BigDecimal poolRatio,
			String calId,String isHealthFlag,String userCode)throws Exception ;

	public CoreProdPlan queryCoreProdPlan(String planCode)throws SQLException ;

	public Page<TradPlanBase> queryTradPlanBasePage(Page<TradPlanBase> page,
			String tradProdCode) throws SQLException;

	public Page<TradPlanCov> queryCoveragePage(Page<TradPlanCov> page) throws SQLException;

	public Page<TradInsuPlan> queryTradInsuPlanPage(Page<TradInsuPlan> page) throws SQLException;

	public void saveCov(List<TradPlanCov> planCovs)throws Exception ;

	public void deletePlan(TradProdPlan tradProdPlan,TradPlanBase tradPlanBase,TradPlanCov tradPlanCov,RiskAlgMap riskAlgMap,String isHealthFlag)throws Exception ;

	public TradProdInst queryTradProdInst(TradProdInst tradProdInst) throws SQLException;

	public TradProdInst editTradProdInst(TradProdInst tradProdInst)throws Exception ;

	public void editTradPlanBase(TradPlanBase tradplanbase,RiskAlgMap riskAlgMap)throws Exception ;

	public TradPlanBase queryTradPlanBase(TradPlanBase tradplanbase)throws Exception ;
	
	public List<TradPlanCov> queryTradPlanCovList(TradPlanCov tradPlanCov)throws SQLException;

	public List<TradPlanCov> findState(TradProdInst tradProdInst)throws SQLException;
	
	public TradProdPlan getTradProdPlan(TradProdPlan pp)throws SQLException;
	
	List<TradProdPlan> queryTradProdPlanList(TradProdPlan qtradProdPlan) throws SQLException ;
	
	public void updatePlanBaseRatio(TradPlanBase base) throws Exception;
	
	TradPlanBase queryTradPlanBaseByCode(String tradPlanCode) throws SQLException ;

	void updateTradProdInst(TradProdInst tradProdInst) throws Exception;
	/**
	 * 查询折扣系数选项
	 * wangyan 
	 * 2015年6月3日18:08:44
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("rawtypes")
	public List<Map> getDiscountTypes()throws Exception;
	/**
	 * 查询子险种算法
	 * wangyan 
	 * 2015年6月5日11:29:53
	 * @return
	 * @throws Exception
	 */
	public List<TradItemCal> getgetChildCals(TradItemCal trad) throws Exception;
	/**
	 * 根据产品获取该产品下的方案
	 * @param tradProdInst
	 * @return
	 * @throws Exception
	 */
	List<TradInsuPlan> queryTradInsuPlans(TradProdInst tradProdInst)throws Exception;
	/**
	 * 根据产品代码判断是否存在方案
	 * @param tradProdCode
	 * @return
	 * @throws Exception
	 */
	public boolean isExistProdPlan(String tradProdCode) throws Exception;
	

	public List<TradPlanBase> queryTradPlanBaseInfoByPlanNo(String polNo) throws SQLException;
};
